package com.yjj.demo.spring.redis.web;

import com.yjj.demo.spring.redis.service.StringService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 *
 * @author yangjiajia
 * @time 2021/9/25 18:35
 */
@RestController
@RequestMapping("/str")
public class StringController {

    @Autowired
    private StringService stringService;

    @GetMapping("/add")
    public String add(@RequestParam("key") String key, @RequestParam("value") String value) {
        stringService.add(key, value);
        return "success";
    }

    @GetMapping("/push")
    public void push() {
        stringService.rightPush();
    }

    @GetMapping("/get")
    public int get() {
        return stringService.getValue();
    }
}
